package com.zhentao.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhentao.pojo.TbWrongQuestions;
import com.zhentao.service.TbWrongQuestionsService;
import com.zhentao.mapper.TbWrongQuestionsMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 刘晋羽
* @description 针对表【tb_wrong_questions(用户错题记录表)】的数据库操作Service实现
* @createDate 2025-10-10 11:02:39
*/
@Service
public class TbWrongQuestionsServiceImpl extends ServiceImpl<TbWrongQuestionsMapper, TbWrongQuestions>
    implements TbWrongQuestionsService{


    // 查询用户错题
    @Override
    public List<TbWrongQuestions> queryWrongQuestionsByUserId(TbWrongQuestions tbWrongQuestions) {
        QueryWrapper<TbWrongQuestions> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id", tbWrongQuestions.getUserId());
        queryWrapper.eq(tbWrongQuestions.getSubjectName()!= null, "subject_name", tbWrongQuestions.getSubjectName());

        return this.list(queryWrapper);
    }

    @Override
    public TbWrongQuestions queryWrongQuestionsById(Integer id) {
        return this.getById(id);
    }

}




